<?php

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//授权登录
Route::group(['namespace' =>'Manage\Controllers'],function(){
    Route::get('login','LoginViewController@login')->name("login");
    Route::post('login','LoginController@login')->name("login");
    Route::post('logout','LoginController@logout')->name("logout");
    Route::get('unauthorized','LoginViewController@unauthorized')->name("unauthorized");
});
Route::group(['middleware' =>'auth.admin'], function () {
    Route::group(['namespace' =>'Publics'],function(){
        Route::put('uploadImg','FileUploadController@imageUpload')->name("uploadImg");
    });
});
Route::group(['middleware' =>['auth.admin','permissions.admin']], function () {
    Route::group(['namespace' =>'Index\Controllers'],function(){
        Route::get('/','IndexController@index')->name("index");
    });
    Route::get('add','TestController@create');
    Route::put('bases','SettingController@saveBase')->name("bases");
    Route::put('bases/upload','SettingController@upload');
    Route::get('index','IndexController@index')->name("index");

    //用户管理
    Route::group(['prefix'=>'users','namespace' =>'User\Controllers'],function(){
        Route::get('/','UserViewController@index')->name("index");
        Route::post('add','UserController@create')->name("add");
        Route::get('lists','UserController@lists')->name("lists");
    });

    //系统设置
    Route::group(['namespace' =>'System\Controllers'],function(){
        Route::get('bases','SettingController@base')->name("bases");
        Route::get('bases/setregion','SettingController@baseSetRegion');
        Route::put('bases','SettingController@saveBase')->name("bases");
        Route::put('bases/upload','SettingController@upload');
    });

    //菜单管理
    Route::group(['prefix'=>'menus','namespace' =>'Menu\Controllers'],function(){
        Route::get('/','MenuViewController@index')->name("index");
        Route::get('add','MenuController@add')->name("add");
        Route::post('add','MenuController@store')->name("add");
        Route::put('status','MenuController@menuStatus')->name("status");
        Route::put('edit','MenuController@menuUpdate')->name("edit");
        Route::put('sort','MenuController@sortUpdate')->name("sort");
        Route::delete('delete','MenuController@menuDelete')->name("delete");
        //菜单下操作管理
        Route::get('action/{menuid}','MenuViewController@action')->name("action");
        Route::post('actionAdd','MenuController@addAction')->name("addaction");
        Route::delete('actionDel','MenuController@deleteAction')->name("deleteaction");

    });

    //后台管理员管理
    Route::group(['prefix'=>'admins','namespace'=>'Manage\Controllers'],function(){
        Route::get('/','AdminViewController@index')->name("index");
        Route::get('add','AdminViewController@add')->name("add");
        Route::get('edit/{id}','AdminViewController@edit')->name("edit");
        Route::get('repass','AdminViewController@repass')->name("repass");
        Route::get('profile','AdminViewController@profile')->name("profile");
        Route::post('repass','AdminController@setpass')->name("repasss");
        Route::post('/','AdminController@store')->name("index");
        Route::delete('del','AdminController@adminDelete')->name("delete");
        Route::put('edit/status','AdminController@adminStatus')->name("status");
        Route::put('edit','AdminController@update')->name("update");
        Route::put('upload','AdminController@uploadPortrait')->name("upload");
    });

    //角色管理
    Route::group(['prefix'=>'roles','namespace' =>'Manage\Controllers'],function(){
        Route::get('/','RoleViewController@index')->name("index");
        Route::get('auth/{id}','RoleViewController@roleAuth')->name("auth");
        Route::post('add','RoleController@store')->name("index");
        Route::put('edit','RoleController@roleUpdate')->name("edit");
        Route::delete('delete','RoleController@roleDelete')->name("delete");
        Route::put('editauth','RoleController@editRoleAuth')->name("editauth");
    });

    //单面管理
    Route::group(['prefix'=>'pages','namespace' =>'Page\Controllers'],function(){
        Route::get('/','PageViewController@index')->name("index");
        Route::get('edit/{id}','PageViewController@edit')->name("edit");
        Route::get('view/{id}','PageViewController@view')->name("view");
        Route::put('update','PageController@update')->name("update");
        Route::get('lists','PageController@lists')->name("lists");
    });
    //系统日志
    Route::group(['prefix'=>'logs','namespace' =>'Manage\Controllers'],function(){
        Route::get('/','LogViewController@index')->name("index");
        Route::get('lists','LogController@lists')->name("lists");
    });
    //插件管理
    Route::group(['prefix'=>'plugs','namespace' =>'Plug\Controllers'],function(){
        Route::get('/','PlugViewController@index')->name("index");
        Route::get('install','PlugController@install')->name("install");
        Route::get('installedLists','PlugController@installedLists')->name("installedLists");
        Route::get('details/{id}','PlugViewController@details')->name("details");
    });
    //api请求日志管理
    Route::group(['prefix'=>'apilogs','namespace' =>'ApiLog\Controllers'],function(){
        Route::get('/','ApiLogViewController@index')->name("index");
        Route::get('install','PlugController@install')->name("install");
        Route::get('lists','ApiLogController@lists')->name("lists");
    });
});